package org.example.campsys.controller;

import org.apache.ibatis.annotations.Param;
import org.example.campsys.model.LearningInfo;
import org.example.campsys.model.Result;
import org.example.campsys.model.UnitInfo;
import org.example.campsys.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    public StudentService studentService;
    @RequestMapping("/selmyunit")
    public Result selMyUnit(Integer courseId){
        return Result.success("查询成功",studentService.selMyUnit(courseId));
    }

    @RequestMapping("/finishstudy")
    public Result finishStudy(LearningInfo learningInfo){
        studentService.finishStudy(learningInfo);
        return Result.success("学习完成",true);
    }
    @RequestMapping("/selmytask")
    public Result selMyTash(Integer stuInClassId){
        return Result.success("查询成功",studentService.selMyTask(stuInClassId));
    }
    @RequestMapping("/selmycourse")
    public Result selMyCourse(Integer loginId){
        Integer a =studentService.selMyStuId(loginId);
        return Result.success("查询成功", studentService.selMyCourse(a));
    }
}
